import { urls } from '@/api/urls'

const http = uni.$u.http

export function getCategory(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.getCategory, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}

export function getIndexBlock(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.getIndexBlock, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}

export function getGoodsList(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.getGoodsList, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}

export function getGoodsDetail(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.getGoodsDetail, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}

export function getImageList(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.imageList, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}

export function getAbouts(data) {
	return new Promise((resolve,reject) => {
		http.get(urls.getAbouts, {
			params: data
		}).then(res => {
			resolve(res)
		}).catch(err => {
			reject(err)
		})
	})
}
